home *** CD-ROM | disk | FTP | other *** search
-
- <xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
- xmlns:out="urn:sample"
- xmlns:outscr="urn:twiddle"
- exclude-result-prefixes="xsl msxsl"
- version="1.0">
- <xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes" />
- <xsl:preserve-space elements="*"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:namespace-alias stylesheet-prefix="outscr" result-prefix="msxsl"/>
-
- <!-- params designed to be overridden by the caller -->
- <xsl:param name="ID">1</xsl:param>
- <xsl:param name="TopLevel">1</xsl:param>
- <xsl:param name="FrameworkOnly">0</xsl:param>
- <xsl:param name="NonWSSViewOnly">0</xsl:param>
- <xsl:param name="ViewSpec">
- <View>
- <RowPath>/catalog/book</RowPath>
- <Fields>
- <Field FName="fld_1" Value="title" Title="title" Type="text"/>
- <Field FName="fld_2" Value="author" Title="author" Type="text"/>
- <Field FName="fld_3" Value="genre" Title="genre" Type="text"/>
- </Fields>
- </View>
- </xsl:param>
- <xsl:param name="StyleName">Table</xsl:param>
- <xsl:param name="ShowToolbar">0</xsl:param>
- <xsl:param name="DoXSLPaging">1</xsl:param>
- <xsl:param name="UsePaging">0</xsl:param>
- <xsl:param name="RowLimit">100</xsl:param>
- <xsl:param name="ShowHeader">0</xsl:param>
- <xsl:param name="ShowFooter">0</xsl:param>
- <xsl:param name="DoXSLJoin">0</xsl:param>
-
- <!-- all localized text params -->
- <xsl:param name="ViewEmptyText">There are no items to display in this view.</xsl:param>
- <xsl:param name="ChooseText">Choose one...</xsl:param>
- <xsl:param name="PreviousLinkText">Previous</xsl:param>
- <xsl:param name="NextLinkText">Next</xsl:param>
- <xsl:param name="FirstLinkText">First</xsl:param>
- <xsl:param name="PageItemsText">Items</xsl:param>
- <xsl:param name="CountText">Count</xsl:param>
- <xsl:param name="AscendingText">Ascending</xsl:param>
- <xsl:param name="DescendingText">Descending</xsl:param>
- <xsl:param name="FilterText">Filter</xsl:param>
- <xsl:param name="YesText">Yes</xsl:param>
- <xsl:param name="NoText">No</xsl:param>
- <xsl:param name="EmptyOptionText">(Empty)</xsl:param>
- <xsl:param name="AllOptionText">(All)</xsl:param>
- <xsl:param name="DefaultLCID">1033</xsl:param>
- <xsl:param name="DefaultDateFormat">5</xsl:param>
- <xsl:param name="DefaultNumberFormat">#,##0.##;-#,##0.##</xsl:param>
-
- <!-- global variables -->
- <xsl:variable name="basename" select="concat('dvt_',$ID)" />
- <xsl:variable name="View" select="msxsl:node-set($ViewSpec)/View" />
- <xsl:variable name="Style" select="/ViewStyles/Style[ID=$StyleName]" />
- <xsl:variable name="Defaults" select="/ViewStyles/Defaults" />
-
- <xsl:template match="/">
- <xsl:choose>
- <xsl:when test="$FrameworkOnly = 1">
- <out:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- exclude-result-prefixes="xsl ddwrt msxsl">
- <out:output method="html" indent="no"/>
- <out:decimal-format NaN=""/>
-
- <xsl:call-template name="gen-dvt-framework" />
-
- </out:stylesheet>
- </xsl:when>
- <xsl:when test="$NonWSSViewOnly = 1">
- <xsl:choose>
- <xsl:when test="$TopLevel = 1">
- <out:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- exclude-result-prefixes="xsl ddwrt msxsl">
-
- <xsl:call-template name="gen-dvt-framework" />
-
- <out:template match="/">
- <out:call-template name="{$basename}"/>
- </out:template>
- <xsl:apply-templates select="$Style" />
- </out:stylesheet>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$Style" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$TopLevel = 1">
- <out:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
- xmlns:msxsl="urn:schemas-microsoft-com:xslt"
- exclude-result-prefixes="xsl ddwrt msxsl">
- <out:output method="html" indent="no"/>
-
- <xsl:call-template name="gen-dvt-framework" />
-
- <out:template match="/">
- <out:call-template name="{$basename}"/>
- </out:template>
- <xsl:apply-templates select="$Style" />
- </out:stylesheet>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$Style" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="gen-dvt-framework">
-
- <!-- BEGIN: params set by runtime -->
-
- <out:param name="dvt_adhocmode"></out:param>
- <out:param name="dvt_adhocfiltermode">xsl</out:param>
- <out:param name="dvt_fieldsort"></out:param>
- <out:param name="dvt_sortfield"></out:param>
- <out:param name="dvt_groupfield"></out:param>
- <out:param name="dvt_groupdisplay"></out:param>
- <out:param name="dvt_sortdir">ascending</out:param>
- <out:param name="dvt_groupdir">ascending</out:param>
- <out:param name="dvt_grouptype"></out:param>
- <out:param name="dvt_sorttype">text</out:param>
- <out:param name="dvt_groupsorttype">text</out:param>
- <out:param name="dvt_filterfield"></out:param>
- <out:param name="dvt_filterval"></out:param>
- <out:param name="dvt_filtertype"></out:param>
- <out:param name="dvt_firstrow">1</out:param>
- <out:param name="dvt_nextpagedata"></out:param>
- <out:param name="dvt_apos">'</out:param>
-
- <!-- o11 #327468: always add a sample param -->
- <out:param name="filterParam"></out:param>
-
- <!-- END: params set by runtime -->
-
- <!-- generic template to display a header field -->
- <out:template name="dvt.headerfield">
- <out:param name="fieldname"/>
- <out:param name="fieldtitle"/>
- <out:param name="sortable">1</out:param>
- <out:param name="attachments">0</out:param>
- <out:choose>
- <out:when test="($dvt_adhocmode = 'sort' or $dvt_fieldsort = '1') and $sortable='1'">
- <out:variable name="sortfield">
- <out:choose>
- <out:when test="substring($fieldname, string-length($fieldname) - 5) = '(text)'">
- <out:value-of select="substring($fieldname, 1, string-length($fieldname) - 6)"/>
- </out:when>
- <out:when test="substring($fieldname, 1, 1) = '@'">
- <out:value-of select="substring($fieldname, 2)"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$fieldname"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="linkdir">
- <out:choose>
- <out:when test="$dvt_sortfield = $sortfield and $dvt_sortdir = 'ascending'">descending</out:when>
- <out:otherwise>ascending</out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="sortText">
- <out:choose>
- <out:when test="$linkdir='descending'">' + 'descending' + '</out:when>
- <out:otherwise>' + 'ascending' + '</out:otherwise>
- </out:choose>
- </out:variable>
- <a>
- <out:attribute name="href">javascript: <out:value-of select="ddwrt:GenFireServerEvent(concat('dvt_sortfield={{',$sortfield,'}};dvt_sortdir={{',$sortText,'}}'))" />;</out:attribute>
- <out:choose>
- <out:when test="$attachments">
- <out:value-of select="$fieldtitle" disable-output-escaping="yes"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$fieldtitle"/>
- </out:otherwise>
- </out:choose>
- <out:if test="$dvt_sortfield = $sortfield">
- <out:choose>
- <out:when test="$dvt_sortdir = 'ascending'">
- <img border="0" alt="{$AscendingText}" src="{{ddwrt:FieldSortImageUrl('Desc')}}" />
- </out:when>
- <out:when test="$dvt_sortdir = 'descending'">
- <img border="0" alt="{$DescendingText}" src="{{ddwrt:FieldSortImageUrl('Asc')}}" />
- </out:when>
- </out:choose>
- </out:if>
- </a>
- </out:when>
- <out:otherwise>
- <out:choose>
- <out:when test="$attachments">
- <out:value-of select="$fieldtitle" disable-output-escaping="yes"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$fieldtitle"/>
- </out:otherwise>
- </out:choose>
- </out:otherwise>
- </out:choose>
- <out:if test="$dvt_filterfield=$fieldname" ddwrt:cf_ignore="1"><img alt="{$FilterText}" src="{{ddwrt:FieldFilterImageUrl('')}}"/></out:if>
- </out:template>
-
- <!-- generic template to display a filter field -->
- <out:template name="dvt.filterfield">
- <out:param name="fieldname"/>
- <out:param name="fieldtitle"/>
- <out:param name="Rows" />
- <out:param name="fieldtype" />
- <out:variable name="fieldnamenoatsign" select="substring-after($fieldname, '@')"/>
- <out:variable name="filtertype"><out:if test="starts-with($fieldtype,'date')">date</out:if></out:variable>
- <out:variable name="sorttype"><out:choose><out:when test="starts-with($fieldtype,'number')">number</out:when><out:otherwise>text</out:otherwise></out:choose></out:variable>
- <out:variable name="clientText">' + this.options[this.selectedIndex].value + '</out:variable>
- <out:if test="not(contains($fieldname, '/')) and not(contains($fieldname, '['))" ddwrt:cf_ignore="1">
- <out:value-of select="$fieldtitle"/>
- <out:text disable-output-escaping="yes">:<br></out:text>
- <select name="{{$fieldname}}_filterval">
- <out:attribute name="onchange">javascript: <out:value-of select="ddwrt:GenFireServerEvent(concat('NotUTF8;dvt_filterfield={{',$fieldname,'}};dvt_filtertype={{',$filtertype,'}};dvt_adhocmode={{false()}};dvt_filterval={{',$clientText,'}}'))" />;</out:attribute>
- <option value="##dvt_empty##">
- <out:if test="$dvt_filterfield=$fieldname and $dvt_filterval=''">
- <out:attribute name="selected">true</out:attribute>
- </out:if>
- <xsl:value-of select="$EmptyOptionText"/>
- </option>
- <option value="##dvt_all##">
- <out:choose>
- <out:when test="not($dvt_filterfield)">
- <out:attribute name="selected">true</out:attribute>
- </out:when>
- <out:when test="$dvt_filterfield!=$fieldname">
- <out:attribute name="selected">true</out:attribute>
- </out:when>
- </out:choose>
- <xsl:value-of select="$AllOptionText"/>
- </option>
- <out:value-of select="ddwrt:NameChanged('',1)"/>
- <out:choose>
- <out:when test="starts-with($fieldname, '@')">
- <out:variable name="dvt_Rows">
- <out:for-each select="$Rows">
- <out:sort select="@*[name()=$fieldname]" order="ascending" data-type="{{$sorttype}}"/>
- <out:copy-of select="." />
- </out:for-each>
- </out:variable>
- <out:for-each select="msxsl:node-set($dvt_Rows)/*[not(@*[name()=$fieldnamenoatsign]=preceding-sibling::*[1]/@*[name()=$fieldnamenoatsign])]/@*[name()=$fieldnamenoatsign]">
- <out:sort data-type="{{$sorttype}}" />
- <out:call-template name="dvt.filteroption">
- <out:with-param name="name" select="$fieldname"/>
- <out:with-param name="value" select="."/>
- <out:with-param name="type" select="$fieldtype"/>
- </out:call-template>
- </out:for-each>
- </out:when>
- <out:when test="$fieldname = '.'">
- <out:variable name="dvt_Rows">
- <out:for-each select="$Rows">
- <out:sort select="." order="ascending" data-type="{{$sorttype}}"/>
- <out:copy-of select="." />
- </out:for-each>
- </out:variable>
- <out:for-each select="msxsl:node-set($dvt_Rows)/*[not(.=preceding-sibling::*[1])]">
- <out:sort data-type="{{$sorttype}}" />
- <out:call-template name="dvt.filteroption">
- <out:with-param name="name" select="$fieldname"/>
- <out:with-param name="value" select="."/>
- <out:with-param name="type" select="$fieldtype"/>
- </out:call-template>
- </out:for-each>
- </out:when>
- <out:otherwise>
- <out:variable name="dvt_Rows">
- <out:for-each select="$Rows">
- <out:sort select="*[name()=$fieldname]" order="ascending" data-type="{{$sorttype}}"/>
- <out:copy-of select="." />
- </out:for-each>
- </out:variable>
- <out:for-each select="msxsl:node-set($dvt_Rows)/*[not(*[name()=$fieldname]=preceding-sibling::*[1]/*[name()=$fieldname])]/*[name()=$fieldname]">
- <out:sort data-type="{{$sorttype}}" />
- <out:call-template name="dvt.filteroption">
- <out:with-param name="name" select="$fieldname"/>
- <out:with-param name="value" select="."/>
- <out:with-param name="type" select="$fieldtype"/>
- </out:call-template>
- </out:for-each>
- </out:otherwise>
- </out:choose>
- <out:value-of select="ddwrt:NameChanged('',1)"/>
- </select>
- </out:if>
- </out:template>
-
- <!-- generic template to display a filter field option tag -->
- <out:template name="dvt.filteroption">
- <out:param name="name"/>
- <out:param name="value"/>
- <out:param name="type"/>
- <out:if test="not(starts-with($type,'date')) or ddwrt:NameChanged($value,1)">
- <out:variable name="output">
- <out:choose>
- <out:when test="$type = 'number'">
- <out:value-of select="format-number($value,'{$DefaultNumberFormat}')"/>
- </out:when>
- <out:when test="starts-with($type,'number|')">
- <out:variable name="spec" select="substring-after($type,'|')" />
- <out:choose>
- <out:when test="contains($spec, 'lcid')">
- <out:variable name="apos">'</out:variable>
- <out:variable name="realspec" select="substring-after($spec, $apos)"/>
- <out:variable name="formatspec" select="substring-before($realspec, $apos)"/>
- <out:variable name="formatspec2" select="substring-after($realspec, $apos)"/>
- <out:variable name="lcid" select="normalize-space(substring-after($formatspec2, ','))"/>
- <out:value-of select="format-number($value,string($formatspec), substring($lcid,2,string-length($lcid)-2))"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="format-number($value,substring($spec,2,string-length($spec)-2))"/>
- </out:otherwise>
- </out:choose>
- </out:when>
- <out:when test="starts-with($type,'date')">
- <!-- don't show time portion when formatting; use long date-only format -->
- <out:value-of select="ddwrt:FormatDate(string($value),{$DefaultLCID},3)"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="$value"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <option>
- <out:attribute name="value">
- <out:value-of select="ddwrt:ConnEncode(normalize-space($value))" />
- </out:attribute>
- <out:if test="$dvt_filterfield=$name and $dvt_filterval=normalize-space($value) and $dvt_filterval!=''">
- <out:attribute name="selected">true</out:attribute>
- </out:if>
- <out:choose>
- <out:when test="string-length($output) > 40">
- <out:value-of select="substring($output, 1, 40)"/> ...
- </out:when>
- <out:otherwise>
- <out:value-of select="$output"/>
- </out:otherwise>
- </out:choose>
- </option>
- </out:if>
- </out:template>
-
- </xsl:template>
-
- <xsl:template match="Style">
-
- <!-- output all the templates -->
-
- <xsl:apply-templates select="Main" />
- <xsl:call-template name="GenHeader" />
- <xsl:apply-templates select="Body" />
- <xsl:call-template name="GenFooter" />
- <xsl:call-template name="GenSummary" />
- <xsl:call-template name="GenEmpty" />
- <xsl:apply-templates select="GroupHeader" />
- <xsl:apply-templates select="GroupFooter" />
-
- <!-- TODO: shouldn't generate these in a TopLevel template -->
- <xsl:call-template name="GenToolbar" />
- <xsl:call-template name="GenNavigation" />
-
- </xsl:template>
-
- <xsl:template name="gen-field-value">
- <xsl:param name="xpath" />
- <xsl:param name="title" />
- <xsl:param name="type" />
- <xsl:param name="rich" />
-
- <xsl:choose>
-
- <!-- field Type="Note", a.k.a. rich text -->
- <xsl:when test="$type='Note'">
- <xsl:choose>
- <xsl:when test="$rich='0'">
- <out:value-of select="{$xpath}" />
- </xsl:when>
- <xsl:otherwise>
- <out:value-of select="{$xpath}" disable-output-escaping="yes"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
-
- <!-- field Type="Boolean", a.k.a. yes/no -->
- <xsl:when test="$type='Boolean'">
- <out:choose>
- <out:when test="{$xpath}='1' or {$xpath}='Yes'">
- <xsl:value-of select="$YesText"/>
- </out:when>
- <out:otherwise>
- <xsl:value-of select="$NoText"/>
- </out:otherwise>
- </out:choose>
- </xsl:when>
-
- <!-- field Type="URL", Format="Hyperlink" -->
- <xsl:when test="$type='Hyperlink'">
- <a>
- <xsl:attribute name="href">{substring-before(<xsl:value-of select="$xpath"/>, ', ')}</xsl:attribute>
- <out:value-of select="substring-after({$xpath}, ', ')"/>
- </a>
- </xsl:when>
-
- <!-- field Type="URL", Format="Image" -->
- <xsl:when test="$type='Image'">
- <img border="0">
- <out:attribute name="src"><out:value-of select="substring-before({$xpath}, ', ')"/></out:attribute>
- <out:attribute name="alt"><out:value-of select="substring-after({$xpath}, ', ')"/></out:attribute>
- </img>
- </xsl:when>
-
- <!-- field Type="Lookup", List="Docs", ShowField="FullUrl" -->
- <xsl:when test="$type='DocHyperlink'">
- <a>
- <out:attribute name="href"><out:value-of select="{$xpath}"/></out:attribute>
- <out:value-of select="{$xpath}"/>
- </a>
- </xsl:when>
-
- <!-- field Type="Lookup", List="Docs", ShowField="FullUrl" -->
- <xsl:when test="$type='DocImage'">
- <img border="0">
- <out:attribute name="src"><out:value-of select="{$xpath}"/></out:attribute>
- <out:attribute name="alt"><out:value-of select="{$xpath}"/></out:attribute>
- </img>
- </xsl:when>
-
- <!-- this indicates the field is actually a subview -->
- <xsl:when test="$type='view'">
- <out:call-template name="{$xpath}"/>
- </xsl:when>
-
- <!-- view regen: expanded types for "number" -->
- <xsl:when test="substring-before($type,'|')='number'">
- <out:value-of select="format-number({$xpath},{substring-after($type,'|')})"/>
- </xsl:when>
-
- <!-- view regen: default for "number" type -->
- <xsl:when test="$type='number'">
- <out:value-of select="format-number({$xpath},'{$DefaultNumberFormat}')"/>
- </xsl:when>
-
- <!-- view regen: expanded types for "date" -->
- <xsl:when test="substring-before($type,'|')='date'">
- <out:value-of select="ddwrt:FormatDate(string({$xpath}),{substring-after($type,'|')})"/>
- </xsl:when>
-
- <!-- view regen: expanded types for "date" -->
- <xsl:when test="substring-before($type,'|')='datetime'">
- <out:value-of select="ddwrt:FormatDateTime(string({$xpath}),{substring-after($type,'|')})"/>
- </xsl:when>
-
- <!-- view regen: default for "date" type -->
- <xsl:when test="$type='date' or $type='datetime'">
- <out:value-of select="ddwrt:FormatDate({$xpath},{$DefaultLCID},{$DefaultDateFormat})"/>
- </xsl:when>
-
- <!-- the default: just use a plain old xsl:value-of tag -->
- <xsl:otherwise>
- <out:value-of select="{$xpath}"/>
- </xsl:otherwise>
-
- </xsl:choose>
-
- </xsl:template>
-
- <xsl:template name="gen-param">
- <out:param name="{@Name}">
- <xsl:value-of select="@Default"/>
- </out:param>
- </xsl:template>
-
- <xsl:template match="Main">
- <!-- this is the root template for the DVT -->
- <out:template name="{$basename}">
- <xsl:for-each select="$Style/Params/Param">
- <xsl:call-template name="gen-param" />
- </xsl:for-each>
- <out:variable name="StyleName"><xsl:value-of select="$StyleName" /></out:variable>
- <xsl:if test="$DoXSLJoin = '1'">
- <out:variable name="dvt_ParentRow">
- <xsl:attribute name="select">current()</xsl:attribute>
- </out:variable>
- </xsl:if>
- <out:variable name="Rows" select="{$View/RowPath}" />
- <out:variable name="RowCount" select="count($Rows)"/>
- <out:variable name="IsEmpty" select="$RowCount = 0" />
-
- <!-- TODO: shouldn't generate these in a TopLevel template -->
- <xsl:if test="$ShowToolbar = '1'">
- <out:call-template name="{$basename}.toolbar">
- <out:with-param name="Rows" select="$Rows" />
- </out:call-template>
- </xsl:if>
-
- <out:choose>
- <out:when test="$IsEmpty">
- <out:call-template name="{$basename}.empty" />
- </out:when>
- <out:otherwise>
- <xsl:apply-templates />
- </out:otherwise>
- </out:choose>
-
- </out:template>
- </xsl:template>
-
- <xsl:template match="Header">
- <out:template name="{$basename}.header">
- <out:param name="Rows"/>
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="Body">
- <out:template name="{$basename}.body">
- <out:param name="Rows"/>
- <out:param name="FirstRow"/>
- <out:param name="LastRow"/>
- <xsl:if test="$DoXSLJoin = '1'">
- <out:param name="dvt_ParentRow"/>
- </xsl:if>
-
- <out:for-each select="$Rows">
- <out:variable name="KeepItemsTogether" select="false()" />
- <out:variable name="HideGroupDetail" select="false()" />
- <out:variable name="GroupStyle" select="'auto'" />
-
- <out:if>
- <xsl:attribute name="test">
- <xsl:choose>
- <xsl:when test="$DoXSLPaging = '1'">(position() >= $FirstRow and position() <= $LastRow) or $KeepItemsTogether</xsl:when>
- <xsl:otherwise>true()</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <out:if test="not($HideGroupDetail)" ddwrt:cf_ignore="1">
-
- <!-- calls to .groupheader template go here -->
-
- <xsl:apply-templates />
-
- <!-- calls to .groupfooter template go here -->
-
- </out:if>
-
- </out:if>
- </out:for-each>
-
- </out:template>
- </xsl:template>
-
- <xsl:template match="Footer">
- <out:template name="{$basename}.footer">
- <out:param name="Rows"/>
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="Summary">
- <out:template name="{$basename}.summary">
- <out:param name="Rows" />
-
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="Empty">
- <out:template name="{$basename}.empty">
- <out:variable name="ViewEmptyText">
- <xsl:value-of select="$ViewEmptyText" />
- </out:variable>
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="Toolbar">
- <out:template name="{$basename}.toolbar">
- <out:param name="Rows" />
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="Navigation">
- <out:template name="{$basename}.navigation">
- <out:param name="FirstRow"/>
- <out:param name="LastRow"/>
- <out:param name="RowLimit"/>
- <out:param name="RowCount"/>
- <out:param name="RealLastRow"/>
-
- <out:variable name="PrevRow">
- <out:choose>
- <out:when test="$FirstRow - $RowLimit < 1">1</out:when>
- <out:otherwise>
- <out:value-of select="$FirstRow - $RowLimit"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="GroupHeader">
- <out:template name="{$basename}.groupheader">
- <out:param name="fieldtitle"/>
- <out:param name="fieldname"/>
- <out:param name="fieldvalue"/>
- <out:param name="fieldtype"/>
- <out:param name="nodeset"/>
- <out:param name="groupid"/>
- <out:param name="displaystyle"/>
- <out:param name="imagesrc"/>
- <out:param name="alttext"/>
- <out:param name="altname"/>
- <out:param name="hidedetail"/>
- <out:param name="showheader"/>
- <out:param name="showheadercolumn"/>
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <xsl:template match="GroupFooter">
- <out:template name="{$basename}.groupfooter">
- <out:param name="fieldtitle"/>
- <out:param name="fieldname"/>
- <out:param name="fieldvalue"/>
- <out:param name="fieldtype"/>
- <out:param name="nodeset"/>
- <out:param name="groupid"/>
- <out:param name="displaystyle"/>
- <out:param name="showfooter"/>
- <out:param name="showfootercolumn"/>
- <xsl:apply-templates />
- </out:template>
- </xsl:template>
-
- <!-- templates to generate default parts of views -->
-
- <xsl:template name="GenEmpty">
- <xsl:choose>
- <xsl:when test="Empty">
- <xsl:apply-templates select="Empty" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="msxsl:node-set($Defaults)/Empty" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GenHeader">
- <xsl:choose>
- <xsl:when test="Header">
- <xsl:apply-templates select="Header" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="msxsl:node-set($Defaults)/Header" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GenFooter">
- <xsl:choose>
- <xsl:when test="Footer">
- <xsl:apply-templates select="Footer" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="msxsl:node-set($Defaults)/Footer" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GenSummary">
- <xsl:choose>
- <xsl:when test="Summary">
- <xsl:apply-templates select="Summary" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="msxsl:node-set($Defaults)/Summary" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GenToolbar">
- <xsl:choose>
- <xsl:when test="Toolbar">
- <xsl:apply-templates select="Toolbar" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="msxsl:node-set($Defaults)/Toolbar" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="GenNavigation">
- <xsl:choose>
- <xsl:when test="Navigation">
- <xsl:apply-templates select="Navigation" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="msxsl:node-set($Defaults)/Navigation" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- implement the known tags in the "dvt" namespace -->
-
- <!-- this tag only works in Navigation template -->
- <xsl:template match="dvt_PrevLink">
- <!-- DSP paging does not support previous; use browser history link instead -->
- <!-- if we are doing xsl paging, then we can simply pass the firstrow value -->
- <a>
- <out:attribute name="href"><xsl:choose>
- <xsl:when test="not($DoXSLPaging = '1')">javascript: history.back();</xsl:when>
- <xsl:otherwise>javascript: <out:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={{',$PrevRow,'}}'))" />;</xsl:otherwise>
- </xsl:choose></out:attribute>
- <xsl:value-of select="$PreviousLinkText"/>
- </a>
- </xsl:template>
-
- <!-- this tag only works in Navigation template -->
- <xsl:template match="dvt_NextLink">
- <!-- if we are doing DSP paging, then we have to pass the dvt_nextpagedata back as the StartPosition -->
- <!-- if we are doing xsl paging, then we can simply pass the firstrow value -->
- <out:if test="$LastRowValue < $RowCount or string-length($dvt_nextpagedata)!=0" ddwrt:cf_ignore="1">
- <a>
- <out:attribute name="href"><xsl:choose>
- <xsl:when test="not($DoXSLPaging = '1')">javascript: <out:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={{',$NextRow,'}};StartPosition={{',$dvt_nextpagedata,'}}'))" />;</xsl:when>
- <xsl:otherwise>javascript: <out:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={{',$NextRow,'}}'))" />;</xsl:otherwise>
- </xsl:choose></out:attribute>
- <xsl:value-of select="$NextLinkText"/>
- </a>
- </out:if>
- </xsl:template>
-
- <!-- this tag only works in Navigation template -->
- <xsl:template match="dvt_FirstLink">
- <a>
- <out:attribute name="href">
- <xsl:choose>
- <!-- if we are doing DSP paging, then we have to pass the firstrow and the StartPosition -->
- <xsl:when test="not($DoXSLPaging = '1')">javascript: <out:value-of select="ddwrt:GenFireServerEvent('dvt_firstrow={{1}};StartPosition={{}}')" />;</xsl:when>
- <!-- if we are doing xsl paging, then we can simply pass the firstrow value -->
- <xsl:otherwise>javascript: <out:value-of select="ddwrt:GenFireServerEvent('dvt_firstrow={{1}}')" />;</xsl:otherwise>
- </xsl:choose>
- </out:attribute>
- <xsl:value-of select="$FirstLinkText"/>
- </a>
- </xsl:template>
-
- <!-- this tag only works in Navigation template -->
- <xsl:template match="dvt_IfNotFirstPage">
- <out:if test="$dvt_firstrow > 1" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_Header">
- <xsl:if test="$ShowHeader = '1'" ddwrt:cf_ignore="1">
- <out:call-template name="{$basename}.header" >
- <out:with-param name="Rows" select="$Rows"/>
- </out:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="dvt_Body">
-
- <out:call-template name="{$basename}.body">
- <out:with-param name="Rows" select="$Rows" />
- <out:with-param name="FirstRow" select="1" />
- <out:with-param name="LastRow" select="$RowCount" />
- <xsl:if test="$DoXSLJoin = '1'">
- <out:with-param name="dvt_ParentRow" select="$dvt_ParentRow"/>
- </xsl:if>
-
- </out:call-template>
-
- </xsl:template>
-
- <xsl:template match="dvt_Footer">
- <xsl:if test="$ShowFooter = '1'" ddwrt:cf_ignore="1">
- <out:call-template name="{$basename}.footer">
- <out:with-param name="Rows" select="$Rows"/>
- </out:call-template>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="dvt_Field[@Name]">
- <xsl:variable name="ThisField" select="$View/Fields/Field[@FName=current()/@Name]"/>
-
- <xsl:call-template name="gen-field-value">
- <xsl:with-param name="xpath" select="$ThisField/@Value" />
- <xsl:with-param name="title" select="$ThisField/@Title" />
- <xsl:with-param name="type" select="$ThisField/@Type" />
- <xsl:with-param name="rich" select="$ThisField/@Rich" />
- </xsl:call-template>
-
- </xsl:template>
-
- <xsl:template match="dvt_Field">
- <xsl:param name="ThisField"/>
-
- <xsl:call-template name="gen-field-value">
- <xsl:with-param name="xpath" select="$ThisField/@Value" />
- <xsl:with-param name="title" select="$ThisField/@Title" />
- <xsl:with-param name="type" select="$ThisField/@Type" />
- <xsl:with-param name="rich" select="$ThisField/@Rich" />
- </xsl:call-template>
-
- </xsl:template>
-
- <xsl:template match="dvt_FieldTitle[@Name]">
- <xsl:variable name="ThisField" select="$View/Fields/Field[@FName=current()/@Name]"/>
- <xsl:value-of select="$ThisField/@Title" />
- </xsl:template>
-
- <xsl:template match="dvt_FieldTitle">
- <xsl:param name="ThisField"/>
- <xsl:value-of select="$ThisField/@Title" />
- </xsl:template>
-
- <xsl:template match="dvt_FieldHeader[@Name]">
- <xsl:variable name="ThisField" select="$View/Fields/Field[@FName=current()/@Name]"/>
- <out:variable name="{$ThisField/@FName}">
- <out:call-template name="dvt.headerfield">
- <out:with-param name="fieldname">
- <xsl:value-of select="$ThisField/@Value"/>
- </out:with-param>
- <out:with-param name="fieldtitle">
- <xsl:value-of select="$ThisField/@Title"/>
- </out:with-param>
- <out:with-param name="Rows" select="$Rows"/>
- </out:call-template>
- </out:variable>
- <out:copy-of select="${$ThisField/@FName}" />
- </xsl:template>
-
- <xsl:template match="dvt_FieldHeader">
- <xsl:param name="ThisField"/>
- <out:variable name="{$ThisField/@FName}">
- <out:call-template name="dvt.headerfield">
- <out:with-param name="fieldname">
- <xsl:value-of select="$ThisField/@Value"/>
- </out:with-param>
- <out:with-param name="fieldtitle">
- <xsl:value-of select="$ThisField/@Title"/>
- </out:with-param>
- <out:with-param name="Rows" select="$Rows"/>
- </out:call-template>
- </out:variable>
- <out:copy-of select="${$ThisField/@FName}" />
- </xsl:template>
-
- <xsl:template match="dvt_FieldFilter">
- <xsl:param name="ThisField"/>
-
- <out:call-template name="dvt.filterfield">
- <out:with-param name="fieldname">
- <!-- Remove synthetized ddw prefixes used for default namespaces when calling into the dvt.filterfield template. -->
- <xsl:choose>
- <xsl:when test="contains($ThisField/@Value, ':') and starts-with($ThisField/@Value, 'ddw')">
- <xsl:value-of select="substring-after($ThisField/@Value, ':')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ThisField/@Value"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:with-param>
- <out:with-param name="fieldtitle">
- <!-- Remove synthetized ddw prefixes used for default namespaces when calling into the dvt.filterfield template. -->
- <xsl:choose>
- <xsl:when test="contains($ThisField/@Title, ':') and starts-with($ThisField/@Title, 'ddw')">
- <xsl:value-of select="substring-after($ThisField/@Title, ':')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ThisField/@Title"/>
- </xsl:otherwise>
- </xsl:choose>
- </out:with-param>
- <out:with-param name="Rows" select="$Rows"/>
- <out:with-param name="fieldtype">
- <xsl:value-of select="$ThisField/@Type"/>
- </out:with-param>
- </out:call-template>
-
- </xsl:template>
-
- <xsl:template match="dvt_FieldFilter[@Name]">
- <xsl:variable name="ThisField" select="$View/Fields/Field[@FName=current()/@Name]"/>
-
- <out:call-template name="dvt.filterfield">
- <out:with-param name="fieldname">
- <xsl:value-of select="$ThisField/@Value"/>
- </out:with-param>
- <out:with-param name="fieldtitle">
- <xsl:value-of select="$ThisField/@Title"/>
- </out:with-param>
- <out:with-param name="Rows" select="$Rows"/>
- <out:with-param name="fieldtype">
- <xsl:value-of select="$ThisField/@Type"/>
- </out:with-param>
- </out:call-template>
-
- </xsl:template>
-
- <xsl:template match="dvt_ForEachField">
- <xsl:variable name="CurNode" select="."/>
- <xsl:variable name="ReqFields">
- <xsl:if test="@ExcludeRequired">
- <xsl:for-each select="$Style/RequiredFields/Field">
- <xsl:text> </xsl:text>
- <xsl:value-of select="@Name"/>
- <xsl:text> </xsl:text>
- </xsl:for-each>
- </xsl:if>
- </xsl:variable>
- <xsl:for-each select="$View/Fields/Field[not(@Hidden) and not(contains($ReqFields,concat(' ',@FName,' ')))]">
- <xsl:variable name="ThisField" select="."/>
- <xsl:variable name="FieldNum" select="position()"/>
- <xsl:apply-templates select="$CurNode/node()">
- <xsl:with-param name="ThisField" select="$ThisField"/>
- <xsl:with-param name="FieldNum" select="$FieldNum"/>
- </xsl:apply-templates>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="dvt_ForEachRow">
- <out:for-each select="{$View/RowPath}">
- <xsl:apply-templates select="node()"/>
- </out:for-each>
- </xsl:template>
-
- <xsl:template match="dvt_IfNotEmpty">
- <out:if test="count({$View/RowPath})!=0">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfEmpty">
- <out:if test="count({$View/RowPath})=0">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfNewGroup">
- <xsl:if test="$View/Sorting[@Grouping='TRUE']">
- <out:if test="$NewGroup = 'TRUE'" ddwrt:cf_ignore="1">
- <xsl:apply-templates>
- <xsl:with-param name="ThisField" select="$View/Fields/Field[@FName=$View/Sorting/SortBy[1]/@Field]"/>
- </xsl:apply-templates>
- </out:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfEvenRow">
- <out:if test="position() mod 2 = 0" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfOddRow">
- <out:if test="position() mod 2 != 0" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfFirstRow">
- <out:if test="position() = 1" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfLastRow">
- <out:if test="position() = last()" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfNotFirstRow">
- <out:if test="position() != 1" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfNotLastRow">
- <out:if test="position() != last()" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfFirstField">
- <xsl:param name="FieldNum"/>
- <xsl:if test="$FieldNum = 1" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfNotFirstField">
- <xsl:param name="FieldNum"/>
- <xsl:if test="$FieldNum != 1" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="dvt_IfVarEq">
- <out:if test="${@name} = '{@value}'" ddwrt:cf_ignore="1">
- <xsl:apply-templates/>
- </out:if>
- </xsl:template>
-
- <xsl:template match="dvt_HTML"><out:text disable-output-escaping="yes"><xsl:apply-templates/></out:text></xsl:template>
-
- <xsl:template match="dvt_NBSP"><out:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes"> </out:text></xsl:template>
-
- <xsl:template match="dvt_Comment"><out:comment><xsl:apply-templates/></out:comment></xsl:template>
-
- <xsl:template match="dvt_GetVar">
- <out:value-of select="${@Name}"/>
- </xsl:template>
-
- <xsl:template match="dvt_ShowVar">
- <out:value-of select="{@Name}"/>
- </xsl:template>
-
- <xsl:template match="dvt_DisplayVar">
- <out:value-of select="${@Name}" disable-output-escaping="yes"/>
- </xsl:template>
-
- <xsl:template match="dvt_ChooseText">
- <xsl:value-of select="$ChooseText"/>
- </xsl:template>
-
- <xsl:template match="dvt_PageItemsText">
- <xsl:value-of select="$PageItemsText" disable-output-escaping="yes"/>
- </xsl:template>
-
- <xsl:template match="dvt_CountText">
- <xsl:value-of select="$CountText" disable-output-escaping="yes"/>
- </xsl:template>
-
- <xsl:template match="*">
- <xsl:param name="ThisField"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates>
- <xsl:with-param name="ThisField" select="$ThisField"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:template>
-
- </xsl:stylesheet>
-
-
-
-